import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '@/./views/HomeView/HomeView'
import DiscoverView from '../views/DiscoverView/DiscoverView.vue'
import SerializeView from '../views/SerializeView/SerializeView.vue'
import MineView from '../views/UserView/MineView.vue'

Vue.use(VueRouter)

const routes = [{
    path: '',
    replace: '/home/:date',
  },
  {
    path: '/',
    replace: '/home/:date',
  },

  {
    path: '/home/:date',
    name: 'home',
    component: HomeView,
    children: [{
      path: 'month-article',
      name: 'month-article',
      component: () => import('../views/MonthArticleView/MonthArticleView.vue')
    }]
  },
  {
    path: '/discover',
    name: 'discover',
    component: DiscoverView,
    children: [{
      path: 'read-month/:category',
      name: 'read-month',
      component: () => import('../views/DiscoverView/ReadMonthView/ReadMonthList.vue')
    }, {
      path: 'hot',
      name: 'hot',
      component: () => import('../views/DiscoverView/HotArticlesView/HotArticlesList.vue')
    }, {
      path: 'author',
      name: 'author',
      component: () => import('../views/DiscoverView/AuthorView/HotAuthorList.vue')
    }, {
      path: 'square',
      name: 'square',
      component: () => import('../views/DiscoverView/SquareView/SquareList.vue')
    }, {
      path: 'photo-article',
      name: 'photo-article',
      component: () => import('../views/MonthArticleView/MonthArticleView.vue')
    }],

  },
  {
    path: '/topic',
    name: 'topic',
    component: () => import('../views/TopicDetailsView/TopicDetails.vue')
  },
  {
    path: '/serialize',
    name: 'serialize',
    component: SerializeView,
  },
  {
    path: '/memories',
    name: 'memories',
    component: () => import('../views/MemoriesChapterView/MemoriesChapterView.vue')
  },
  {
    path: '/mine',
    name: 'mine',
    component: MineView
  },
  {
    path: '/detail',
    name: 'detail',
    component: () => import('../views/ArticleDetailView/ArticleDetailView')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/UserView/LoginView.vue')
  }

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router